#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);

	int a = 0;
	int min = 1000;
	int max = 0;
	while (n--)
	{
		scanf("%d", &a);
		if (min > a)min = a;
		if (max < a)max = a;
	}
	printf("%d\n", max - min);
	return 0;
}